package com.uspacex.calculate.mapper;

import com.uspacex.calculate.entity.AnalysisTaskInfo;
import com.uspacex.calculate.entity.FullReport;
import com.uspacex.calculate.entity.ReportTablesInfo;
import org.apache.ibatis.annotations.*;

import java.util.List;
import java.util.Map;

@Mapper
public interface AnalysisTaskMapper {

    @Select("SELECT * FROM data_analysis_db.task_info")
    List<AnalysisTaskInfo> getAllTasks();

    @Select("SELECT * FROM data_analysis_db.task_info WHERE task_id = #{taskId}")
    AnalysisTaskInfo getATask(@Param("taskId") String taskId);

    @Insert("INSERT IGNORE into data_analysis_db.task_info(task_id, task_name, create_time, task_desc) " +
            "VALUES (#{task.taskId}, #{task.taskName}, #{task.createTime}, #{task.taskDesc})")
    void createATask(@Param("task") AnalysisTaskInfo task);

    @Delete("DELETE FROM data_analysis_db.task_info WHERE task_id = #{taskId}")
    void deleteTask(@Param("taskId") String taskId);

    @Update("UPDATE data_analysis_db.task_info SET datasets = #{datasets} WHERE task_id = #{taskId}")
    void setDataset(@Param("datasets") String datasets, @Param("taskId") String taskId);

    @Select("SELECT * FROM data_analysis_db.subject_db_info")
    List<Map<String, Object>> getAllSubjectDBs();



}
